
import request from '@/utils/request'

/**
 * 获取组织架构数据
 * @returns
 */

export function getDepartments() {
  return request({
    url: '/company/department'
  })
}

/**
 *  删除部门接口
 * @param {*} id
 */
export const delDepartments = (id) => {
  return request({
    url: `/company/department/${id}`,
    method: 'delete'
  })
}

/**
 * 新增部门接口
 * @param {*} data 参数对象
 * @returns
 */
export const addDepartments = (data) => {
  return request({
    url: '/company/department',
    method: 'post',
    data
  })
}

/**
 * 获取员工的简单列表 部门负责人的下拉数据
 * @returns
 */
export const getEmployeeSimple = () => {
  return request({
    url: '/sys/user/simple'
  })
}

/**
 *  获取部门详情
 * @param {*} id // 部门的id
 * @returns
 */
export const getDepartDetail = (id) => {
  return request({
    url: `/company/department/${id}`
  })
}

/**
 * 编辑部门
 * @param {*} data 构建的参数对象
 * @returns
 */
export const updateDepartments = (data) => {
  return request({
    url: `/company/department/${data.id}`,
    method: 'put',
    data
  })
}
